package phoenics.manpads.stinger.controller;

import de.felixroske.jfxsupport.FXMLController;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.CheckBoxTableCell;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import phoenics.manpads.stinger.model.DatabaseTableModel;

import java.net.URL;
import java.util.ResourceBundle;

/**
 * 编辑数据库表
 *
 * @author Phoenics Chow
 * on 2019年01月22日
 */
@FXMLController
public class EditTableController implements Initializable {
    private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(EditTableController.class);
    @FXML
    TableColumn coluName;
    @FXML
    TableColumn coluType;
    @FXML
    TableColumn coluLength;
    @FXML
    TableColumn coluDot;
    @FXML
    TableColumn coluIsNotNull;
    @FXML
    TableColumn coluKey;
    @FXML
    TableColumn coluReadme;
    @FXML
    TableView scachmaTable;

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        configTableColumn();
        //scachmaTable.getItems().add()

    }
    private void configTableColumn(){
        coluName.setCellFactory(TextFieldTableCell.forTableColumn());
        coluType.setCellFactory(TextFieldTableCell.forTableColumn());
        coluLength.setCellFactory(TextFieldTableCell.forTableColumn());
        coluDot.setCellFactory(TextFieldTableCell.forTableColumn());
        coluIsNotNull.setCellFactory(CheckBoxTableCell.forTableColumn(coluIsNotNull));
        coluKey.setCellFactory(CheckBoxTableCell.forTableColumn(coluKey));
        coluReadme.setCellFactory(TextFieldTableCell.forTableColumn());
    }
    public void createColumn(){
        DatabaseTableModel tmodel=new DatabaseTableModel();
        scachmaTable.getItems().add(tmodel);

    }
}
